function resendActivationLink() {
	$("#spinner").spin('modal');
	var email = $('#user-acitvation-renew-email').html();
	jQuery.ajax({
		type : 'POST',
		url : "/User/reSendActivationLink",
		data : {
			userEmail : email
		},
		async : true,
		dataType : "json",
		success : function(dataReceived) {
			removeSpinner();
		}
	});
}
function resendActivationLinkOnMessage(emailResend){
	$("#spinner").spin('modal');
	jQuery.ajax({
		type : 'POST',
		url : "/User/reSendActivationLink",
		data : {
			userEmail : emailResend
		},
		async : true,
		dataType : "json",
		success : function(dataReceived) {
			removeSpinner();
		}
	});
	$('.alert-message-expired-link').delay(3000).fadeOut(1000);
}
function loginFunction() {
	$("#spinner").spin('modal');
	var val1 = $("#userEmail").val().trim();
	var val2 = $("#password").val();
	var val3 = $("#remember").is(':checked');
	if (val1 == "" && val2 == "") {
		removeSpinner();
		$("#loginMessage").html("Please enter the email and password");
		$('#loginMessage').show();
		return;
	} else if (val1 == "") {
		removeSpinner();
		$("#loginMessage").html("Please enter the email");
		$('#loginMessage').show();
		return;
	} else if (val2 == "") {
		removeSpinner();
		$("#loginMessage").html("Please enter the password");
		$('#loginMessage').show();
		return;
	}
	jQuery.ajax({
		type : 'POST',
		url : "/User/login",
		data : {
			userEmail : val1,
			password : val2,
			remember : val3
		},
		async : true,
		dataType : "json",
		success : function(dataReceived) {
			if (dataReceived.info === "Successful") {
				window.location.href = '/manage/index';
			} else {
				removeSpinner();
				$("#loginMessage").html(dataReceived.info);
				$('#loginMessage').show();
			}
		}
	});
}
function sendResetLink() {
	$("#spinner").spin('modal');
	var email = $('#forgotEmail').val().trim();
	jQuery.ajax({
		type : 'POST',
		url : "/User/forgetPassword",
		data : {
			forgotEmail : email
		},
		async : true,
		dataType : "json",
		success : function(dataReceived) {
			removeSpinner();
			if (dataReceived.info == "Send email forget password successfull"){
				window.location.href="/home/index";
			}
			else{
				$('#forgotPwdMessage').html(dataReceived.info);
				$('#forgotPwdMessage').show();
				$('#form-forgetPwd .form-group').addClass("has-error has-feedback")
			}
		}
	});
}